<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
import watermark from "watermark-dom";

export default {
  name: 'App',
  metaInfo() {
    return {
      title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
      titleTemplate: title => {
        return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
      }
    }
  },
  mounted() {
    // "watermark-dom": "2.3.0"
    // 加载水印
    const username = this.$store.state.user.name;
    let now = new Date();
    let year = now.getFullYear();
    let month = now.getMonth() + 1;
    let day = now.getDate();
    month = month < 10 ? '0' + month : month;
    day = day < 10 ? '0' + day : day;
    let date = year + '-' + month + '-' + day;

    watermark.load({
      watermark_txt: `${username}  ${date}`,
      watermark_width: 160,                //水印宽度
      watermark_height: 160,               //水印长度
    });
  }
}
</script>
<style lang="stylus">
@import "base"
</style>
